<template>
	<view class="add">
		<view class="first" v-if="open">

			<view class="info">
				<view class="tit">
					期望另一半信息
				</view>
				<u-form :model="model" label-width="180" :rules="rules" ref="uForm1" :errorType="errorType">
					<u-form-item :label-position="labelPosition" label="年龄范围" prop="ageRange">
						<!-- <view @click="showSlider('age')" class="line"> -->
						<view @click="showMinAge=true" class="line">
							<view class="inp">
								<view
									style="width: 100%;  height: 35px;  display: flex; align-items: center; justify-content: flex-end;">
									
									<!-- {{model.minAge}} -->
									<view class="really" v-if="model.minAge && !model.maxAge">{{model.minAge}}岁 ~ 以上</view>
									<view class="really" v-if="model.minAge && model.maxAge">{{model.minAge}} ~ {{model.maxAge}}岁</view>
									<view v-if="!model.minAge && !model.maxAg" class="please">请选择</view>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<!-- 年龄选择 -->
					<u-select title="选择最小年龄" @confirm="AgeMinConfirm" v-model="showMinAge" :list="AgeMinlist"></u-select>
					<u-select title="选择最大年龄" @cance="AgeMaxCancel" @confirm="AgeMaxConfirm" v-model="showMaxAge" :list="AgeMaxlist"></u-select>
					


					<u-form-item :label-position="labelPosition" label="省份">
						<view class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really" v-if="nextInfo">{{nextInfo.province}}</text>
								</view>
							</view>
						</view>
					</u-form-item>
					<u-form-item :label-position="labelPosition" label="选择省市">
						<view @click="storeIdShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.storeIdLable">{{model.storeIdLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 选择省市 -->
					<u-select @confirm="storeIdConfirm" v-model="storeIdShow" :list="actionstoreIdList">
					</u-select>

					<u-form-item :label-position="labelPosition" label="身高范围">
						<view @click="showMinHeight=true" class="line">
							<view class="inp">
								<view
									style="width: 100%;  height: 35px;  display: flex; align-items: center; justify-content: flex-end;">
									<view class="really" v-if="model.minHeight">{{model.minHeight}} ~
										{{model.maxHeight}}cm
									</view>
									<view v-else class="please">请选择</view>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 身高选择 -->
					<u-select title="选择最小身高" @confirm="HeightMinConfirm" v-model="showMinHeight" :list="HeightMinlist"></u-select>
					<u-select title="选择最大身高" @cance="HeightMaxCancel" @confirm="HeightMaxConfirm" v-model="showMaxHeight" :list="HeightMaxlist"></u-select>
					
					

					<u-form-item :label-position="labelPosition" label="体重范围">
						<view @click="showMinWeight=true" class="line">
							<view class="inp">
								<view
									style="width: 100%;  height: 35px;  display: flex; align-items: center; justify-content: flex-end;">
									<view class="really" v-if="model.minWeight">{{model.minWeight}} ~
										{{model.maxWeight}}kg
									</view>
									<view v-else class="please">请选择</view>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 体重选择 -->
					<u-select title="选择最小体重" @confirm="WeightMinConfirm" v-model="showMinWeight" :list="WeightMinlist"></u-select>
					<u-select title="选择最大体重" @cance="WeightMaxCancel" @confirm="WeightMaxConfirm" v-model="showMaxWeight" :list="WeightMaxlist"></u-select>
					
					<!-- <u-popup :closeable="true" close-icon-color="#0F1417" close-icon-size="30" border-radius="30"
						v-model="AgeShow" mode="bottom">
						<view class="agePop" v-if="AgeShow">
							<view class="title">
								<text v-if="sliderType=='age'">选择年龄范围</text>
								<text v-else-if="sliderType=='height'">选择身高范围</text>
								<text v-else-if="sliderType=='weight'">选择体重范围</text>

							</view>
							<view class="infos">
								<view class="name">
									<text v-if="sliderType=='age'">年龄</text>
									<text v-else-if="sliderType=='height'">身高</text>
									<text v-else-if="sliderType=='weight'">体重</text>

								</view>
								<view class="value" v-if="curAgeInfo">
									{{curAgeInfo.minValue}} ~ {{curAgeInfo.maxValue}}

									<text v-if="sliderType=='age'">岁</text>
									<text v-else-if="sliderType=='height'">cm</text>
									<text v-else-if="sliderType=='weight'">kg</text>
								</view>
							</view>
							<view class="slider">
								<s-region-slider :fillMinValue="fillMinValue" :fillValue="fillValue"
									:minValue="minValue" :maxValue="maxValue" :step="1" @up="up" @down="down"
									@move="move" />
							</view>

							<view class="btns1">
								<u-button shape="circle" type="error" class="button" @click="submitAge" :ripple="true"
									ripple-bg-color="#d7d8da">保存</u-button>
							</view>
						</view>
					</u-popup> -->


					<u-form-item :label-position="labelPosition" label="月收入">
						<view @click="minMonthIncomeShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.minMonthIncomeLable">{{model.minMonthIncomeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 月收入 -->
					<u-select @confirm="minMonthIncomeConfirm" v-model="minMonthIncomeShow" :list="actionminMonthIncomeList">
					</u-select>

					<u-form-item :label-position="labelPosition" label="年收入">
						<view @click="minYearIncomeShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.minYearIncomeLable">{{model.minYearIncomeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 年收入 -->
					<u-select @confirm="minYearIncomeConfirm" v-model="minYearIncomeShow" :list="actionminYearIncomeList">
					</u-select>

					<u-form-item :label-position="labelPosition" label="希望婚况">
						<view @click="hopeMarriageStateShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.hopeMarriageStateLable">{{model.hopeMarriageStateLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 希望婚况 -->
					
					
					<u-select @confirm="hopeMarriageStateConfirm" v-model="hopeMarriageStateShow" :list="actionhopeMarriageStateList">
					</u-select>

					<u-form-item :label-position="labelPosition" label="希望学历">
						<view @click="hopeEducationTypeShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.hopeEducationTypeLable">{{model.hopeEducationTypeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 希望学历 -->
					<u-select @confirm="hopeEducationTypeConfirm" v-model="hopeEducationTypeShow" :list="actionhopeEducationTypeList">
					</u-select>
					


					<u-form-item :label-position="labelPosition" label="何时结婚">
						<view @click="hopeMarriageTimeShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.hopeMarriageTimeLable">{{model.hopeMarriageTimeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 何时结婚 -->
					<u-select @confirm="hopeMarriageTimeConfirm" v-model="hopeMarriageTimeShow" :list="actionhopeMarriageTimeList">
					</u-select>



					<u-form-item :label-position="labelPosition" label="是否想要孩子">
						<view @click="hopeWantChildShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.hopeWantChildLable">{{model.hopeWantChildLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<!-- 是否想要孩子 -->
					<u-select @confirm="hopeWantChildConfirm" v-model="hopeWantChildShow" :list="actionhopeWantChildList">
					</u-select>

					<u-form-item :label-position="labelPosition" label="是否有小孩">
						<view @click="hopeHasChildShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.hopeHasChildLable">{{model.hopeHasChildLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 是否有小孩 -->
					<u-select @confirm="hopeHasChildConfirm" v-model="hopeHasChildShow" :list="actionhopeHasChildList">
					</u-select>


					<!-- <u-form-item :label-position="labelPosition" label="体型">
						<view @click="hopeShapeShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.hopeShapeLable">{{model.hopeShapeLable}}</text>
									<text v-else class="please">请选择体型</text>
								</view>
							</view>
							<view class="more">
								<image src="
https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item> -->
					<!-- 请选择体型 -->
					<u-select @confirm="hopeShapeConfirm" v-model="hopeShapeShow" :list="actionhopeShapeList">
					</u-select>

					<u-form-item :label-position="labelPosition" label="是否吸烟">
						<view @click="hopeSmokeShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.hopeSmokeLable">{{model.hopeSmokeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					<!-- 是否吸烟 -->
					<u-select @confirm="hopeSmokeConfirm" v-model="hopeSmokeShow" :list="actionhopeSmokeList">
					</u-select>

					<u-form-item :label-position="labelPosition" label="是否喝酒">
						<view @click="hopeDrinkShow=true" class="line">
							<view class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.hopeDrinkLable">{{model.hopeDrinkLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<!-- 是否喝酒 -->
					<u-select @confirm="hopeDrinkConfirm" v-model="hopeDrinkShow" :list="actionhopeDrinkList">
					</u-select>






					<view class="dif">
						<u-form-item label-position="top" label="备注">

							<view class="intro" style="margin-top: 0; margin-right: 24rpx;">
								<view style="height: 132rpx;">
									<u-input :border="false" :maxlength="300" :height="120" :auto-height="false"
										v-model="model.note" type="textarea" />

								</view>
								<view class="max">
									{{model.note.length}}/300
								</view>
							</view>
						</u-form-item>
					</view>
				</u-form>
			</view>
			<view class="botBox">
				<view class="itemBtn pre" @click="preStep">
					上一步
				</view>
				<view class="itemBtn next">
					<u-button shape="circle" type="error" @click="submit" :ripple="true" ripple-bg-color="#d7d8da">保存
					</u-button>
				</view>
			</view>
		</view>

		<u-select v-if="comShow" @confirm="comConfirm" v-model="comShow" :list="actionStatusList"></u-select>


	</view>
</template>

<script>
	import sRegionSlider from '@/components/s-region-slider/s-region-slider.vue'
	import dayjs from 'dayjs'
	import gppDatePicker from "@/components/gpp-datePicker/gpp-datePicker.vue"
	export default {
		props: ['nextInfo'],
		data() {
			return {
				// 年龄
				showMinAge:false,
				curMinAge:'',
				showMaxAge:false,
				AgeMinlist:[],
				AgeMaxlist:[],
				
				//身高
				showMinHeight:false,
				curMinHeight:'',
				showMaxHeight:false,
				HeightMinlist:[],
				HeightMaxlist:[],
				
				// 体重
				showMinWeight:false,
				curMinWeight:'',
				showMaxWeight:false,
				WeightMinlist:[],
				WeightMaxlist:[],
				
				storeIdShow:false,
				actionstoreIdList:[],
		
				
				curAgeInfo: null,
				sliderType: '',
				AgeShow: false,
				fillMinValue: undefined,
				fillValue: undefined,
				minValue: 18,
				maxValue: 60,
				open: true,
				errorType: ['message', 'toast'],
				labelPosition: 'left',
				actionSheetShow: false,
				addrshow: false,
				comShow: false,
				model: {
					id: '',
					customerId: '', //客户ID

					minAge: "", //最小年龄
					maxAge: '', //最大年龄
					minHeight: '', //最小身高
					maxHeight: '', //最大身高
					minWeight: '', //最小体重
					maxWeight: '', //最大体重
					
					minMonthIncomeLable: '',
					minMonthIncome: '', //月收入最低
					minYearIncomeLable: '',
					minYearIncome: '', //最小年收入
					storeIdLable: '', //区域ID
					storeId: '', //区域ID
					hopeMarriageStateLable: "",
					hopeMarriageState: '', //希望婚况
					hopeEducationTypeLable: '',
					hopeEducationType: '', //希望学历
					hopeMarriageTimeLable: '',
					hopeMarriageTime: '', //希望何时结婚
					hopeWantChildLable: '',
					hopeWantChild: '', //是否想要孩子
					hopeHasChildLable: '',
					hopeHasChild: '', //有没有孩子
					// hopeShapeLable: '',
					// hopeShape: '', //体型
					hopeSmokeLable: '',
					hopeSmoke: '', //是否吸烟
					hopeDrinkLable: '',
					hopeDrink: '', //是否喝酒
					note: '', //简短说明


				},

				rules: {

				},
				border: false,


				actionStatusList: [

				],
				checked: false,
				cur: '',
				//是否喝酒
				hopeDrinkShow: false,
				actionhopeDrinkList: [],
				// 是否吸烟
				hopeSmokeShow: false,
				actionhopeSmokeList:[],
				// 请选择体型
				hopeShapeShow:false,
				actionhopeShapeList:[],
				// 是否有小孩
				hopeHasChildShow:false,
				actionhopeHasChildList:[],
				// 是否想要孩子
				hopeWantChildShow:false,
				actionhopeWantChildList:[],
				// 何时结婚
				hopeMarriageTimeShow:false,
				actionhopeMarriageTimeList:[],
				// 希望学历
				hopeEducationTypeShow:false,
				actionhopeEducationTypeList:[],
				// 希望婚况
				hopeMarriageStateShow:false,
				actionhopeMarriageStateList:[],
				// 年收入
				minYearIncomeShow:false,
				actionminYearIncomeList:[],
			// 月收入
			minMonthIncomeShow:false,
			actionminMonthIncomeList:[],
			}
		},
		computed: {
			borderCurrent() {
				return this.border ? 0 : 1;
			},
		},
		components: {
			gppDatePicker,
			sRegionSlider
		},
		mounted() {
			// this.model.storeId = this.nextInfo?.storeId
			
			// // 年收入集合
			// this.getallYearIncomes()
			// //月年收入集合
			//  this.getallMonthIncomes()
			// 情感状态集合
			// this.getallhopeMarriageStates()
			// 教育情况集合
			// this.getallhopeEducationTypes()
			// 希望何时结婚集合
			// this.getallHopeMarriageTimes()
			// // 是否想要孩子集合
			// this.getallHopeWantChilds()
			// // 证件类型集合
			// this.getallCertificateTypes()

			// 是否喝酒
			this.getallHopeDrinks()
			// 是否吸烟
			this.getallHopeSmokes()
			// 体型集合
			this.getallHopeShapes()
			// 有没有孩子集合
			this.getallHopeHasChilds()
			// 是否想要孩子集合
			this.getallHopeWantChilds()
			// 何时结婚
			this.getallHopeMarriageTimes()
			// 希望学历
			this.getallhopeEducationTypes()
			// 情感状态集合
			this.getallhopeMarriageStates()
			// 年收入集合
			this.getallYearIncomes()
			//月年收入集合
			this.getallMonthIncomes()
			//选择省市
			this.getstoreIdLable()
			// 获取升高体重年龄
			this.getMinInfoList()
			
			console.log(this.nextInfo?.id,'&&&&&&');
			
			this.model.customerId = this.nextInfo?.id
			
			console.log(this.nextInfo, 44557777);
			if (this.model.customerId) {
				this.$u.api.hopedetailForUpdate({
						customerId: this.model.customerId
					})
					.then(res => {
						if(res?.data){
							this.model = {
								...res?.data
							}
							this.model.storeIdLable = res?.data?.city
							
							console.log(res,55555555555555);
						}
						
						
						
						
					});
			}
		},
		methods: {
			// 确定最小年纪
			AgeMinConfirm(val){
				this.curMinAge = val[0].value
				this.showMinAge = false
				this.showMaxAge = true
				this.getMaxAgelist(val[0].value)
			},
			AgeMaxCancel(){
				this.curMinAge =''
				// this.AgeMinlist=[]
				this.showMinAge = true
				this.showMaxAge = false
				
			},
			// 确定最大年纪
			AgeMaxConfirm(val){
				this.model.minAge = this.curMinAge
				this.model.maxAge = val[0].value
			},
			
			// 根据最小年纪获取最大年纪
			getMaxAgelist(val){
				this.AgeMaxlist=[]
				console.log(val,2222222);
				let age = val || 18
				for (let i = age; i <= 60; i++) {
					this.AgeMaxlist.push({
						value: i,
						label: i + '岁'
					})
				}
			},

			// 确定最小身高
			HeightMinConfirm(val){
				this.curMinHeight = val[0].value
				this.showMinHeight = false
				this.showMaxHeight = true
				this.getMaxHeightlist(val[0].value)
			},
			HeightMaxCancel(){
				this.curMinHeight =''
				// this.AgeMinlist=[]
				this.showMinHeight = true
				this.showMaxHeight = false
				
			},
			// 确定最大身高
			HeightMaxConfirm(val){
				this.model.minHeight = this.curMinHeight
				this.model.maxHeight = val[0].value
			},
			// 根据最小身高获取最大身高
			getMaxHeightlist(val){
				this.HeightMaxlist=[]
				let age = val || 129
				for (let i = age; i <= 211; i++) {
					this.HeightMaxlist.push({
						value: i,
						label: i + 'cm'
					})
				}
			},
			
			
			// // 体重
			// showMinWeight:false,
			// curMinWeight:'',
			// showMaxWeight:false,
			// WeightMinlist:[],
			// WeightMaxlist:[],
			
			// 确定最小体重
			WeightMinConfirm(val){
				this.curMinWeight = val[0].value
				this.showMinWeight = false
				this.showMaxWeight = true
				this.getMaxWeightlist(val[0].value)
			},
			WeightMaxCancel(){
				this.curMinWeight =''
				// this.AgeMinlist=[]
				this.showMinWeight = true
				this.showMaxWeight = false
				
			},
			// 确定最大体重
			WeightMaxConfirm(val){
				this.model.minWeight = this.curMinWeight
				this.model.maxWeight = val[0].value
			},
			// 根据最小体重获取最大体重
			getMaxWeightlist(val){
				this.WeightMaxlist=[]
				let age = val || 30
				for (let i = age; i <= 130; i++) {
					this.WeightMaxlist.push({
						value: i,
						label: i + 'kg'
					})
				}
			},
			// 获取升高体重年龄
			getMinInfoList() {
				
				for (let i = 18; i <= 60; i++) {
					this.AgeMinlist.push({
						value: i,
						label: i + '岁'
					})
				}
			
				for (let i = 129; i <= 211; i++) {
					this.HeightMinlist.push({
						value: i,
						label: i + 'cm'
					})
				}
			
				for (let i = 30; i <= 130; i++) {
					this.WeightMinlist.push({
						value: i,
						label: i + 'kg'
					})
				}
			
			},
			
			// 选择省市
			getstoreIdLable() {
				this.$u.api.getcurlist({
						mallId: this.nextInfo?.mallId
					})
					.then(res => {
						this.actionstoreIdList = res.data?.map(r => {
							return {
								value: r.id,
								label: r.city
							}
						})
					});
			},
			storeIdConfirm(val) {
				this.model.storeIdLable = val[0].label;
				this.model.storeId= val[0].value;
			},
			
			// 月年收入集合
			getallMonthIncomes() {
				this.$u.api.allMinMonthIncomes()
					.then(res => {
						this.actionminMonthIncomeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			minMonthIncomeConfirm(val) {
				this.model.minMonthIncomeLable = val[0].label;
				this.model.minMonthIncome= val[0].value;
			},
			
			// 年收入
			getallYearIncomes() {
			
				this.$u.api.allMinYearIncomes()
					.then(res => {
						this.actionminYearIncomeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			
			minYearIncomeConfirm(val) {
				console.log(val,88888888888);
				this.model.minYearIncomeLable = val[0].label;
				this.model.minYearIncome = val[0].value;
			},
			
			// 情感状态集合
			getallhopeMarriageStates() {
				this.$u.api.allHopeMarriageStates()
					.then(res => {
						this.actionhopeMarriageStateList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
						
						this.actionhopeMarriageStateList.unshift({
							value:'',
							label: '不限'
						})
					});
			},
			
			hopeMarriageStateConfirm(val) {
				this.model.hopeMarriageStateLable = val[0].label;
				this.model.hopeMarriageState = val[0].value;
			},
			// 希望学历
			getallhopeEducationTypes() {
				this.$u.api.allEducationTypes()
					.then(res => {
						this.actionhopeEducationTypeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
							
						this.actionhopeEducationTypeList.unshift({
							value:'',
							label: '不限'
						})
					});
			},
			hopeEducationTypeConfirm(val) {
				this.model.hopeEducationTypeLable = val[0].label;
				this.model.hopeEducationType = val[0].value;
			},
			
			// 希望何时结婚集合
			getallHopeMarriageTimes() {
				this.$u.api.allHopeMarriageTimes()
					.then(res => {
						this.actionhopeMarriageTimeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			hopeMarriageTimeConfirm(val) {
				this.model.hopeMarriageTimeLable = val[0].label;
				this.model.hopeMarriageTime = val[0].value;
			},
			
			// 是否想要孩子集合
			getallHopeWantChilds() {
				this.$u.api.allHopeWantChilds()
					.then(res => {
						this.actionhopeWantChildList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			hopeWantChildConfirm(val) {
				this.model.hopeWantChildLable = val[0].label;
				this.model.hopeWantChild = val[0].value;
			},
			
			
			// 有没有孩子集合
			getallHopeHasChilds() {
				this.$u.api.allHopeHasChilds()
					.then(res => {
						this.actionhopeHasChildList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			hopeHasChildConfirm(val) {
				this.model.hopeHasChildLable = val[0].label;
				this.model.hopeHasChild = val[0].value;
			},
			// 体型集合
			getallHopeShapes() {
				this.$u.api.allHopeShapes()
					.then(res => {
						this.actionhopeShapeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			// 选择体型
			hopeShapeConfirm(val) {
				this.model.hopeShapeLable = val[0].label;
				this.model.hopeShape = val[0].value;
			},
			// 是否喝酒集合
			getallHopeDrinks() {
				this.$u.api.allHopeDrinks()
				.then(res => {
					this.actionhopeDrinkList = res.data?.map(r => {
						return {
							value: r.code,
							label: r.name
						}
					})
				});
			},
			// 是否喝酒确认
			hopeDrinkConfirm(val) {
				this.model.hopeDrinkLable = val[0].label;
				this.model.hopeDrink = val[0].value;
			},
			
			// 是否吸烟
			getallHopeSmokes() {
				this.$u.api.allHopeSmokes()
					.then(res => {
						this.actionhopeSmokeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			// 是否吸烟确认
			hopeSmokeConfirm(val) {
				this.model.hopeSmokeLable = val[0].label;
				this.model.hopeSmoke = val[0].value;
			},
			// 上一步
			preStep() {
				this.$emit('preStepFn')
			},
			showSlider(val) {
				this.curAgeInfo = null
				this.sliderType = val
				this.AgeShow = true
				if (val == 'age') {
					this.fillMinValue = 18;
					this.fillValue = 60
					this.minValue = 18;
					this.maxValue = 60;
				} else if (val == 'height') {
					this.fillMinValue = 129;
					this.fillValue = 211;
					this.minValue = 129;
					this.maxValue = 211;
				} else if (val == 'weight') {
					this.fillMinValue = 30;
					this.fillValue = 130;
					this.minValue = 30;
					this.maxValue = 130;
				}
			},
			submitAge() {
				this.AgeShow = false
				if (this.sliderType == 'age') {
					this.model.minAge = this.curAgeInfo?.minValue || 18
					this.model.maxAge = this.curAgeInfo?.maxValue || 60
				} else if (this.sliderType == 'height') {
					this.model.minHeight = this.curAgeInfo?.minValue || 129
					this.model.maxHeight = this.curAgeInfo?.maxValue || 211
				} else if (this.sliderType == 'weight') {
					this.model.minWeight = this.curAgeInfo?.minValue || 30
					this.model.maxWeight = this.curAgeInfo?.maxValue || 130
				}

			},
			down(e) {
				// e中包含了原有的e信息, 并添加了custom对象
				const type = e.custom.type;
				const minValue = e.custom.minValue;
				const maxValue = e.custom.maxValue;
				console.log(e.custom, 111111);
				this.curAgeInfo = e.custom
			},
			up(e) {
				// e中包含了原有的e信息, 并添加了custom对象
				const type = e.custom.type;
				const minValue = e.custom.minValue;
				const maxValue = e.custom.maxValue;
				const curValue = e.custom.curValue;
				console.log(e.custom, 222222);
				this.curAgeInfo = e.custom
			},
			move(e) {
				// e中包含了原有的e信息, 并添加了custom对象
				const type = e.custom.type;
				const minValue = e.custom.minValue;
				const maxValue = e.custom.maxValue;
				console.log(e.custom, 333333);
				this.curAgeInfo = e.custom
			},

			format(val) {
				return val + '%'
			},
			handleRangeChange(e) {
				this.rangeValue = e
			},

			Fnopen() {
				this.open = true
				this.$nextTick(() => {
					this.$refs.uForm1.setRules(this.rules);
				})
			},

			successUpload1(data, index, lists) {
				let url = data.data;
				this.fileList11.push(url);
				this.model.images = JSON.parse(JSON.stringify(this.fileList11));
			},
			onRemove1(index) {
				this.fileList11.splice(index, 1);
				this.model.images = JSON.parse(JSON.stringify(this.fileList11))
			},

			// 选择
			comSel(val) {
				this.cur = val

				// if (val == 'hopeWantChildLable') {
				// 	// 是否想要孩子集合
				// 	this.getallHopeWantChilds()
				// } 
				// else if (val == 'hopeHasChildLable') {
				// 	// 有没有孩子集合
				// 	this.getallHopeHasChilds()
				// } 
				// else if (val == 'hopeShapeLable') {
				// 	// 体型集合
				// 	this.getallHopeShapes()
				// } 
				// else if (val == 'hopeSmokeLable') {
				// 	// 是否吸烟
				// 	this.getallHopeSmokes()
				// }
				// else if (val == 'hopeDrinkLable') {
				// 	// 是否喝酒
				// 	this.getallHopeDrinks()
				// } 
				// if (val == 'hopeMarriageTimeLable') {
				// 	// 何时结婚
				// 	this.getallHopeMarriageTimes()
				// } else
				//  if (val == 'hopeEducationTypeLable') {
				// 	// 希望学历
				// 	this.getallhopeEducationTypes()
				// } else 
				// if (val == 'hopeMarriageStateLable') {
				// 	// 希望学历
				// 	this.getallhopeMarriageStates()
				// } else 
				
				// if (val == 'minYearIncomeLable') {
				// 	// 年收入集合
				// 	this.getallYearIncomes()
				// } else
				//  if (val == 'minMonthIncomeLable') {
				// 	//月年收入集合
				// 	this.getallMonthIncomes()
				// } else 
				// if (val == 'storeIdLable') {
				// 	//选择省市
				// 	this.getstoreIdLable()
				// }
			},
			comConfirm(val) {
				if (this.cur == 'hopeSmokeLable') {

					this.model.hopeSmokeLable = val[0].label;
					this.model.hopeSmoke = val[0].value;
				} else if (this.cur == 'hopeDrinkLable') {
					this.model.hopeDrinkLable = val[0].label;
					this.model.hopeDrink = val[0].value;
				} else if (this.cur == 'hopeWantChildLable') {
					this.model.hopeWantChildLable = val[0].label;
					this.model.hopeWantChild = val[0].value;
				} else if (this.cur == 'hopeShapeLable') {
					this.model.hopeShapeLable = val[0].label;
					this.model.hopeShape = val[0].value;
				} else if (this.cur == 'hopeHasChildLable') {
					this.model.hopeHasChildLable = val[0].label;
					this.model.hopeHasChild = val[0].value;
				} else if (this.cur == 'hopeMarriageTimeLable') {
					this.model.hopeMarriageTimeLable = val[0].label;
					this.model.hopeMarriageTime = val[0].value;
				} else if (this.cur == 'hopeEducationTypeLable') {
					this.model.hopeEducationTypeLable = val[0].label;
					this.model.hopeEducationType = val[0].value;
				} else if (this.cur == 'hopeMarriageStateLable') {
					this.model.hopeMarriageStateLable = val[0].label;
					this.model.hopeMarriageState = val[0].value;
				} else if (this.cur == 'minMonthIncomeLable') {
					this.model.minMonthIncomeLable = val[0].label;
					this.model.minMonthIncome = val[0].value;
				} else if (this.cur == 'minYearIncomeLable') {
					this.model.minYearIncomeLable = val[0].label;
					this.model.minYearIncome = val[0].value;
				} else if (this.cur == 'storeIdLable') {
					this.model.storeIdLable = val[0].label;
					this.model.storeId = val[0].value;
				}

			},

			
			
			
			
			
			// 证件类型集合
			getallCertificateTypes() {

				this.$u.api.allCertificateTypes()
					.then(res => {
						this.actioncertificateTypeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
		

		

			
			





			

			onCancel(e) {
				console.log(e);
			},

			submit() {
				let that = this
				this.$refs.uForm1.validate(valid => {
					if (valid) {
						
						console.log(that.model,9999999);
						let {
							id,
							customerId,
							minAge,
							maxAge,
							minHeight,
							maxHeight,
							minWeight,
							maxWeight,
							minMonthIncome,
							minYearIncome,
							storeId,
							hopeMarriageState,
							hopeEducationType,
							hopeMarriageTime,
							hopeWantChild,
							hopeHasChild,
							// hopeShape,
							hopeSmoke,
							hopeDrink,
							note
						} = that.model;

						let paramsQuery = {}

						let query = {
							customerId,
							minAge,
							maxAge,
							minHeight,
							maxHeight,
							minWeight,
							maxWeight,
							minMonthIncome,
							minYearIncome,
							storeId,
							hopeMarriageState,
							hopeEducationType,
							hopeMarriageTime,
							hopeWantChild,
							hopeHasChild,
							// hopeShape,
							hopeSmoke,
							hopeDrink,
							note
						};
						if (id) {
							paramsQuery = {
								...query,
								id
							}
						} else {
							paramsQuery = {
								...query
							}
						}
						console.log(paramsQuery, 88888);
						that.$u.api.updatehope(paramsQuery)
							.then(res => {
								that.$u.toast(res.msg);
								console.log(res.data?.id,'%%%%%%%%%');
								if (res.code == 'ok') {
									
// 									subPack/crm/detail// id=1812409618102132738

uni.redirectTo({
					url: "/subPack/crm/detail?id=" +res.data?.customerId
				})

									// uni.redirectTo({
									// 	url: "/subPack/crm/index"
									// })
								}
							});
					} else {
						console.log('验证失败');
					}
				});
			},

			confirmAddr(e) {
				console.log(e);
				this.model.addr = e?. [0]?.label + e?. [1]?.label
				this.model.storeId = e?. [1]?.value
			},
			// 点击actionSheet回调
			sexConfirm(val) {
				console.log(val);

				uni.hideKeyboard();
				this.model.genderLable = val[0].label;
				this.model.gender = val[0].value;
			},
			allHopeMarriageTimesConfirm(val) {
				uni.hideKeyboard();
				this.model.hopeMarriageTimeLable = val[0].label;
				this.model.hopeMarriageTime = val[0].value;
			},
			// minYearIncomeConfirm(val) {
			// 	uni.hideKeyboard();
			// 	this.model.minYearIncomeLable = val[0].label;
			// 	this.model.minYearIncome = val[0].value;
			// },
			weightConfirm(val) {
				uni.hideKeyboard();
				this.model.weightLable = val[0].label;
				this.model.weight = val[0].value;
			},
			minMonthIncomeConfirm(val) {
				uni.hideKeyboard();
				this.model.minMonthIncomeLable = val[0].label;
				this.model.minMonthIncome = val[0].value;
			},
			hopeEducationTypeConfirm(val) {
				this.model.hopeEducationTypeLable = val[0].label;
				this.model.hopeEducationType = val[0].value;
			},
			certificateTypeLableConfirm(val) {
				this.model.certificateTypeLable = val[0].label;
				this.model.certificateType = val[0].value;
			},
			hopeMarriageStateConfirm(val) {
				this.model.hopeMarriageStateLable = val[0].label;
				this.model.hopeMarriageState = val[0].value;
			},


			codeChange(text) {
				this.codeTips = text;
			},
			// 获取验证码
			getCode() {
				if (this.$refs.uCode.canGetCode) {
					// 模拟向后端请求验证码
					uni.showLoading({
						title: '正在获取验证码',
						mask: true
					})
					setTimeout(() => {
						uni.hideLoading();
						// 这里此提示会被this.start()方法中的提示覆盖
						this.$u.toast('验证码已发送');
						// 通知验证码组件内部开始倒计时
						this.$refs.uCode.start();
					}, 2000);
				} else {
					this.$u.toast('倒计时结束后再发送');
				}
			},
			errorChange(index) {
				if (index == 0) this.errorType = ['message'];
				if (index == 1) this.errorType = ['toast'];
				if (index == 2) this.errorType = ['border-bottom'];
				if (index == 3) this.errorType = ['border'];
			}

		}
	}
</script>
<style>
	page {
		background: #F6F6F6;
	}

	/deep/ .dif .u-border-bottom:after {
		border-bottom-width: 0px !important;
	}
</style>
<style scoped lang="scss">
	/deep/ .u-input__textarea{
		height: 66px !important;
		text-align: left !important; 
	}
	.add {
		padding: 0 0 100rpx 0;



		.botBox {
			z-index: 8;
			position: fixed;
			left: 40rpx;
			bottom: 90rpx;
			padding-bottom: env(safe-area-inset-bottom);
			right: 40rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.itemBtn {
				flex: 1;

				&.pre {
					display: flex;
					align-items: center;
					justify-content: center;
					font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #0F1417;
					line-height: 44rpx;
					height: 80rpx;
					background: #FFFFFF;
					box-shadow: 0rpx 20rpx 24rpx 0rpx rgba(190, 190, 190, 0.2);
					border-radius: 44rpx 44rpx 44rpx 44rpx;
					margin-right: 24rpx;
				}

				&.next {
					border-radius: 44rpx 44rpx 44rpx 44rpx;
					box-shadow: 0rpx 20rpx 24rpx 0rpx rgba(181, 36, 44, 0.2);
				}
			}
		}

		.agePop {
			padding: 40rpx 0;

			.title {
				padding: 0 40rpx;
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 500;
				font-size: 40rpx;
				color: #0F1417;
				line-height: 47rpx;
				margin-bottom: 34rpx;
			}

			.infos {
				padding: 0 40rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 32rpx;
				color: rgba(15, 20, 23, 0.6);
				line-height: 38rpx;

				.value {
					font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 32rpx;
					color: #0F1417;
					line-height: 38rpx;
				}
			}

			.slider {
				margin: -56rpx 10rpx 80rpx;
			}
		}



		/deep/ .u-form-item__body {
			padding-right: 24rpx;
		}

		/deep/ .u-input__input {
			text-align: right;
			// margin-right: 24rpx;
		}

		.btns1 {
			margin: 24rpx 68rpx;
			background: #FA4A53;
			box-shadow: 0rpx 20rpx 24rpx 0rpx rgba(181, 36, 44, 0.2);
			border-radius: 40rpx 40rpx 40rpx 40rpx;
		}

		.intro {
			margin-top: 24rpx;
			padding: 6rpx 16rpx 0;
			height: 176rpx;
			background: #F1F1F1;
			border-radius: 10rpx 10rpx 10rpx 10rpx;

			/deep/ .u-input__input {
				text-align: left !important;
				// margin-right: 24rpx;
			}

			/deep/ textarea,
			/deep/ uni-textarea {
				text-align: left !important;
				height: 60px;
			}



			.max {
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 24rpx;
				color: rgba(15, 20, 23, 0.4);
				line-height: 28rpx;
				text-align: right;
				padding-bottom: 5rpx;
			}
		}



		.please {
			font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
			font-weight: 400;
			font-size: 28rpx;
			color: #808080;
			line-height: 33rpx;
		}

		.really {
			font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
			font-weight: 500;
			font-size: 28rpx;
			color: #0F1417;
			line-height: 33rpx;
		}

		.line {
			flex: 1;
			display: flex;

			.inp {
				flex: 1;

				.inpCont {
					width: 100%;
					height: 35px;
					text-align: right;
				}
			}

			.more {
				image {
					width: 30rpx;
					height: 30rpx;
					margin-top: 21rpx;
				}
			}
		}


		/deep/ .u-form-item__message {
			text-align: right;
			margin-right: 24rpx;
		}

		/deep/ .u-form-item--left__content--required {
			// left: 88rpx;
		}

		.info {
			margin-bottom: 24rpx;
			padding: 24rpx;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;

			.tit {
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 500;
				font-size: 36rpx;
				color: #0F1417;
				line-height: 42rpx;
			}
		}

		.photos {
			padding: 24rpx;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-bottom: 24rpx;

			.open {
				margin-top: 16rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 28rpx;
				color: #0F1417;
				line-height: 33rpx;
			}

			.tit {
				margin-bottom: 18rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.left {
					display: flex;
					align-items: center;

					>text:nth-child(1) {
						font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
						font-weight: 500;
						font-size: 28rpx;
						color: #0F1417;
						line-height: 40rpx;
					}

					>text:nth-child(2) {
						font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
						font-weight: 400;
						font-size: 24rpx;
						color: rgba(15, 20, 23, 0.4);
						line-height: 28rpx;
					}
				}

				.right {
					font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 24rpx;
					color: rgba(15, 20, 23, 0.4);
					line-height: 28rpx;
				}
			}
		}
	}


	/deep/ .u-size-default {
		box-shadow: 0rpx 20rpx 24rpx 0rpx rgba(190, 190, 190, 0.2) !important;
		border: none;
	}

	/deep/ .u-hairline-border.data-v-6e15e680:after {
		border: none !important;
	}
</style>
